// 用户头像点击之后的弹窗的样式
document.addEventListener('DOMContentLoaded', function () {
    const profile = document.querySelector('.profile');
    const dropdown = profile.querySelector('.dropdown');

    // 点击头像或倒三角形时显示/隐藏下拉菜单
    profile.addEventListener('click', function (event) {
        if (dropdown.style.visibility === 'hidden' || !dropdown.style.visibility) {
            dropdown.style.visibility = 'visible';
            dropdown.style.opacity = '1';
        } else {
            dropdown.style.visibility = 'hidden';
            dropdown.style.opacity = '0';
        }
        event.stopPropagation(); // 阻止事件冒泡到document
    });

    // 当点击页面其他地方时关闭下拉菜单
    document.addEventListener('click', function (event) {
        if (!profile.contains(event.target)) { // 如果点击不在.profile内
            dropdown.style.visibility = 'hidden';
            dropdown.style.opacity = '0';
        }
    });
});
// 退出登录函数
function tuichu() {
    window.location.href = 'index.html'; // 跳转到登录页面
}
